﻿using UnityEngine;
using System;
using System.Linq;
using System.Collections;

using Hont;

namespace Hont.C2UTool
{
    public class VertexAnimationStaticInfoAnalyzer : IC2UStaticInfoAnalyzer
    {
        public int Priority { get { return 2; } }


        public bool CanSlover(string componentName)
        {
            return componentName == "C4DVetexAnimator";
        }

        public C2UStructs.StaticInfoArgumentStruct[] Analyze(string gameObjectPath, string componentName, string argumentInfoStr)
        {
            C2UStructs.StaticInfoArgumentStruct[] result = null;

            return result;
        }

        public void ApplyToTarget(C2UStructs.StaticInfoStruct info, GameObject targetObject)
        {
            var vertexAnimator = targetObject.AddComponent<C4DVetexAnimator>();

            if (vertexAnimator.transform.parent == null) return;

            vertexAnimator.mesh = vertexAnimator.transform.parent.GetComponent<MeshFilter>();
            vertexAnimator.vertexArray = targetObject.GetComponentsInChildren<Transform>();
        }
    }
}
